package com.atmaowei.controller;

import com.alibaba.fastjson.JSON;
import com.atmaowei.common.Result;
import com.atmaowei.entity.TimeSet;
import com.atmaowei.service.TimeSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/timeSet")
public class TimeSetController {

    @Autowired
    private TimeSetService timeSetService;

    @GetMapping("/getTeacher")
    public Result getTeacher() {
        return Result.success(timeSetService.getTeacher());
    }

    @GetMapping("/getStudent")
    public Result getStudent() {
        return Result.success(timeSetService.getStudent());
    }

    @PostMapping("/insertInfo")
    public Result insertInfo(@RequestBody TimeSet timeSet) {
        timeSetService.insertInfo(timeSet);
        return Result.success();
    }

    @PutMapping("/update")
    public Result update(@RequestBody TimeSet timeSet) {
        timeSetService.update(timeSet);
        return Result.success();
    }

}
